﻿using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Config1
{
    public class TestWebConfig
    {
        private readonly IOptionsSnapshot<WebConfig> snapshot;
        public TestWebConfig(IOptionsSnapshot<WebConfig> snapshot)
        {
            this.snapshot= snapshot;
        }

        public void Test()
        {
            WebConfig webConfig=snapshot.Value;
            Console.WriteLine(webConfig.conn1.connectionString);
            Console.WriteLine(webConfig.conn2.connectionString);
            Console.WriteLine(webConfig.config.Age);
            Console.WriteLine(webConfig.config.Proxy.Address);
            Console.WriteLine(string.Join(",",webConfig.config.Proxy.Ids));
        }
    }
}
